<?php


namespace frontend\models;
use yii\db\ActiveRecord;
use frontend\models\Goods;

class Order extends  ActiveRecord
{
    public static function tableName()
    {
        return '{{order}}';
    }
     public static function getUserorder($user_id){
       $order=self::find()->where(['user_id'=>$user_id])->asArray()->all();
       return $order;
     }
     public  static function addOrder($goods_id){
        $order=new Order();
        $order->order_time=time();
        $order->user_id=User::getUserId();
        $order->order_status=1;
        $order->order_address="北京海淀shangdiqijie";
        $order_price=Goods::getGoods($goods_id)->goods_price;
        $res=$order->save();
        return $res;
     }
}